<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?>
<title><?= $sf_response->getTitle() ?></title>
<?php use_helper('DateForm') ?>
<?php use_stylesheet('excelbutton') ?>
<?php use_stylesheet('/sf/sf_admin/css/main') ?>
<style type="text/css">
<!--
.style1 {
	font-size: 18px;
	font-weight: bold;
}
.style2 {color: #FF9090}
.style3 {color: #0000FF}
.style4 {color: #00FF00}
.style5 {color: #FF00FF}
-->
</style>

<div id="sf_admin_container">

<h1>Purchase Value</h1>

<div id="sf_admin_content">
<?php echo form_tag('report/valuePO', array(
  'id'        => 'sf_admin_edit_form',
  'name'      => 'sf_admin_edit_form',
  'multipart' => true,
)) ?>

<fieldset id="sf_fieldset_none" class="">

<div class="form-row">
  <label for="client_name" class="required">From Date:</label>  
  <div class="content">  
  <?php echo select_month_tag('filters[frommonth]', isset($filters['frommonth']) ? $filters['frommonth'] : 1) ?>
  <?php echo select_year_tag('filters[fromyear]', isset($filters['fromyear']) ? $filters['fromyear'] : null) ?>
    </div>
</div>

<div class="form-row">
  <label for="client_name" class="required">To Date:</label>  
  <div class="content">    
  <?php echo select_month_tag('filters[tomonth]', isset($filters['tomonth']) ? $filters['tomonth'] : null) ?>
  <?php echo select_year_tag('filters[toyear]', isset($filters['toyear']) ? $filters['toyear'] : null) ?>
  </div>
</div>


</fieldset>
<ul class="sf_admin_actions">
  <li><?php echo submit_tag(__('Report'), array (
  'name' => 'report',
  'class' => 'sf_admin_action_save',
)) ?></li>
   <li><?php echo submit_tag(__('Export To Excel'), array (
  'name' => 'ExportToExcel',
  'class' => 'sf_admin_action_save',
)) ?></li>
 
</ul>

</form>
<BR/><BR/>
<? 
if (isset($result) && count($result) )
{
?>

<p align="center" class="style1">PURCHASE ORDER VALUE BY TYPE</p>

<?
   $keysRow = array_keys($result);
   $keysCol = array_keys($result[$keysRow[0]]);

    $ydata1 =array_values($result['Stock']);
    $ydata2 =array_values($result['Factory']);
    $ydata3 =array_values($result['Other']);
    $ydata4 =array_values($result['Project']);
   
   include('barlinealphachartMR.php');
?>

<BR/><BR/>

<table width="100%" border="1" cellpadding="0" cellspacing="0" class="textalignright">
  <tr>
    <td style="text-align:justify"><strong>TYPE</strong></td>
    <? 
    
    foreach ($keysCol as $key) 
    {
    ?>
        <td style="text-align:center"><strong><? echo $key?></strong></td>
    <?    
    }
    ?>
  </tr>
<? 
foreach ($keysRow as $row)
{
?>
  <tr>
    <td style="text-align:justify"><b><?echo $row?></b></td>
    
    <? foreach ($keysCol as $col) 
    {
    ?>
        <td><p align="right"><? echo CommonValues::FormatCurrency($result[$row][$col]) ?></td>
    <?    
    }
    ?>
    
  </tr>
<?
}
?>
</table>
<?}?>


</div>


</div>